#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

void Test1(){
    int n;
    while(cin>>n){
        stack<string> st;
        string id, operate;
        int maxsize = 0;
        for(int i = 0; i < n; ++i){
            cin>>id>>operate;
            //如果遇到connect就入栈
            if(operate == "connect")
                st.push(id);
                //否则出栈
            else
                st.pop();
            maxsize = maxsize > st.size() ? maxsize : st.size();
        }
        cout<<maxsize<<endl;
    }
}


void Test2(){
    int n;
    while(cin>>n){
        vector<string> v(n);
        //接收所有数据
        for(int i = 0; i < n; ++i)
            cin>>v[i];
        //将所有数据排序好
        sort(v.begin(), v.end());
        //
        vector<bool> flag(n, true);
        for(int i = 0; i < v.size()-1; ++i){
            //如果相等
            if(v[i] == v[i+1])
                flag[i] = false;
                //如果是子串,查找是否存在，判断长度，处理/a和/a/b这种情况
            else if(v[i] == v[i+1].substr(0,v[i].size()) && v[i].size()<v[i+1].size()
                    && v[i+1][v[i].size()] == '/')
                flag[i] = false;
        }
        //打印
        for(int i = 0; i < n; ++i){
            if(flag[i])
                cout<<"mkdir -p "<<v[i]<<endl;
        }
        cout<<endl;
    }
}

int main() {
    Test2();
    return 0;
}
